The DLL allows Visual Basic to call Windodws API function EnumFonts.
The same function is called multiple times, as described here:
1. Call VBEnumFonts to find how many typefaces are there
2. Allocate an array to accept typefaces
3. Call VBEnumFonts to get the typefaces
4. For each typeface, call VBEnumFonts to find how many fonts are available.
Then allocate 3 arrays of the appropriate size, and call VBEnumFonts to
get information about the fonts.
The interface is declared by:
Declare Function VBEnumFonts Lib "enumfont.dll" (ByVal hDC%, ByVal lpFaceName As Any, lpLogFontArray As Any, lpTextMetricArray As Any, nFontTypeArray As Any, ByVal nArraySize%) As Integer
Where:
hDC% Is the context handle to the default printer, typically
provided by Printer.hDC
lpFaceName Is either a null, or the name of the desired typeface. If
Null, the function will return one font for each available typeface.
Reminder -- Null in VB is indicated by "byval 0&"
lpLogFontArray Is either a null, or the first element of an array of type
LOGFONT. The array should be large enought to accept as
many items as specified by the last parameter.
lpTextMetricArray Is either a null, or the first element of an array of type
TEXEMETRIC. The array should be large enough to accept
As many elelment as specified by the last parameter.
nFontTypeArray Is either a null, or the first element of an array of type
integer. The array should be large enough to accept as
many elements as specified by the last parameter.
nArraySize% Is the number of elemnets expected, e.g the size of the
three arrays. Can be 0, in which case no data will be
transfered to the arrays. The function will return data
up to the number of elements specified.
Function Returns: The number of available fonts which meet the
specification. If lpFaceName is null, this would be
the number of typefaces. If lpFaceName specifies a typeface,
this will be the number of fonts under that typeface.
-----
You are free to use this code and incorporate it in your programs.
If you find it useful, a $7.50 payment will be appreciated. In return,
you will be informed of future changes/enhancements.
------
The author makes no warranties, express or implied, oral or written,
including any implied warranties of merchantability or fitness for a
particular use. In no event will the author be liable for any damages